export const routerUtil = {
    /**
     * 注册模块。
     * @param permissions 
     */
    registerModule(router, permissions) {
        for (let item of permissions) {
            router.removeRoute(item.name);
        }

        const modules = import.meta.glob('@/views/**/*.vue');
        for (let item of permissions) {
            const component = {
                path: item.path,
                name: item.name,
                component: modules[`/src/views/${item.component}`],
                meta: { title: item.meta.title, parent: item.meta.parent ?? null }
            };
            router.addRoute("home", component);
        }
    },
}